public class Player extends Thread
{
  int playerX, playerY;
  int targetX, targetY;
  
  
  public Player()
  {
    playerX=200;
    playerY=200;
  }
  
  public void changeTarget(int x, int y)
  {
    targetX=x;
    targetY=y;
  }
  
  public void run()
  {
    while(true)
    {
      if (playerX!=targetX||playerY!=targetY)
      {
        if (playerX<targetX)
          playerX++;
        else if (playerX>targetX)
          playerX--;
        
        if (playerY>targetY)
          playerY--;
        else if (playerY<targetY)
          playerY++;
        try
        {
          Thread.sleep(10);
        }
        catch (Exception e)
        {
        }
      }
      
    }
  }
}